<template>
  <div>
    <!-- <el-form-item label="占位内容">
      <el-input v-model="data.placeholder"
                clearable
                placeholder="占位内容"></el-input>
    </el-form-item> -->
    <el-form-item label="最小值">
      <el-input-number v-model="localData.min" controls-position="right" placeholder="最小值" />
    </el-form-item>
    <el-form-item label="最大值">
      <el-input-number v-model="localData.max" controls-position="right" placeholder="最大值" />
    </el-form-item>
    <el-form-item label="步长">
      <el-input-number v-model="localData.step" controls-position="right" placeholder="步长" />
    </el-form-item>
    <el-form-item label="数值精度">
      <el-input-number
        v-model="localData.precision"
        controls-position="right"
        placeholder="数值精度"
        :precision="0"
        :min="0"
        :max="10"
      />
    </el-form-item>
    <el-form-item label="开启控制器" label-width="100px">
      <el-switch v-model="localData.controls" />
    </el-form-item>
    <el-form-item label="控制器位置" label-width="100px" v-if="localData.controls">
      <el-radio v-model="localData.controlsPosition" label="left">默认 </el-radio>
      <el-radio v-model="localData.controlsPosition" label="right">右 </el-radio>
    </el-form-item>
    <!-- <edit-formula :data="data" :formJson="formJson" /> -->
  </div>
</template>

<script>
export default {
  name: 'ConfigNumber',
  props: {
    data: {
      type: Object,
      default: () => {}
    },
    formJson: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      localData: {}
    }
  },
  watch: {
    data: {
      handler(newVal) {
        if (newVal) {
          this.localData = newVal
        }
      },
      deep: true,
      immediate: true
    },
    localData: {
      handler(newVal) {
        this.$emit('update:data', newVal)
      },
      deep: true
    }
  }
}
</script>
